<template lang="pug">
  FullScreenDialog(ref="dialog")
    template(v-slot:header)
      v-toolbar(dark, color='primary')
        v-btn(icon, dark, @click='cancel')
          v-icon close
        v-toolbar-title {{ title }}
        v-spacer
        v-toolbar-items
    template(v-slot:default)
      transition(name='bounceUp', mode='out-in')
        keep-alive
          component(
            style="animation-duration: 0.3s"
            ref="childCmp"
            :is='view'
            :asset="bundle"
            @toggleModel="onToggleModel"
          )
</template>

<script lang="ts">
  import Vue, {VueConstructor} from 'vue'
  import FullScreenDetailsMixin from "@/components/mixins/FullScreenDetailsMixin"
  import FullScreenDialog from '@/components/widgets/dialog/FullScreenDialog.vue'
  import AssetBundleView from './asset_bundle_view'
  import AssetBundleForm from './asset_bundle_form'

  export default (Vue as VueConstructor<Vue & {

  }>).extend({
    mixins: [FullScreenDetailsMixin],
    name: 'asset-bundle-details',
    props: ['bundle'],
    components: {FullScreenDialog, AssetBundleView, AssetBundleForm},
    computed: {
      needRefresh() {
        return false
      },
      view() {
        return this.isViewModel ? AssetBundleView : AssetBundleForm
      }
    },
    data(){
      return {
        title: ""
      }
    }
  })
</script>
